import React, {useEffect, useRef, useState} from 'react';
import Child from "./Child";
function App(props) {
	const h3Ref = useRef();
	const [num,setNum] = useState(100);
	const [userName,setUserName] = useState("zhangsan");
	const [isShow,setIsShow] = useState(true);
	useEffect(()=>{
		// console.log("useEffect",h3Ref.current.innerText);
	})
	return (
		<div>
			<h3 ref={h3Ref}>{num}</h3>
			<button onClick={()=>{
				setNum(num+1)
			}}>{num}</button>
			<button onClick={()=>{
				setUserName(userName+"!")
			}}>{userName}</button>
			<button onClick={()=>setIsShow(!isShow)}>显示以及隐藏</button>
			{isShow && <Child/>}
		</div>
	);
}

export default App;